package com.oig.sys.query.constants;

public class ExpressionEnum {

    public static final String S_DIS = "distinct";
    /*
     * public static final String C_EQ = "$eq";
    public static final String C_GT = "$gt"; // >
    public static final String C_GTE = "$gte"; // >=
    public static final String C_IN = "$in"; // in
    public static final String C_LT = "$lt"; // <
    public static final String C_LTE = "$lte"; // <=
    public static final String C_NE = "$ne"; // !=
    public static final String C_NIN = "$nin"; // not in
    public static final String C_LIKE = "$like"; // like
    public static final String C_BETWEEN = "$between"; // range
    public static final String C_JSON_EQ = "@>"; // pg json
    public static final String C_JSON_CONTAINS = "@contains"; // json array
     */
    public enum MongoSymbolEnum{
        EQ("$eq","="),
        NE("$ne","!="),
        GT("$gt",">"),
        GTE("$gte",">="),
        LT("$lt","<"),
        LTE("$lte","<="),
        LIKE("$like","like"),
        IN("$in","in"),
        NIN("$nin","not in"),
        BETWEEN("$between","between"),
        JSON_CONTAINS("@contains","JSON_CONTAINS"),
        JSON_EQ("@>","@>"),
        AND("$and","and"),
        OR("$or", "or"),
        NULL("$null", "is null"),
        NOTNULL("$notnull","is not null")
        ;
        private final String mongoStr;
        private final String sqlStr;

        public String getMongoStr(){
            return mongoStr;
        }
        public String getSqlStr(){
            return sqlStr;
        }


        public static String getValueByKey(String key){
            for(MongoSymbolEnum mongoSymbolEnum : MongoSymbolEnum.values()){
                if (mongoSymbolEnum.getMongoStr().equals(key)){
                    return mongoSymbolEnum.getSqlStr();
                }
            }
            return null;
        }

        MongoSymbolEnum(String mongoStr, String sqlStr){
            this.mongoStr = mongoStr;
            this.sqlStr = sqlStr;
        }

    }



}
